www.gusucode.com > 地方成人教育中心整站源代码 1 > 地方成人教育中心整站源代码 1.0/GuestBook.asp

    <!--#include file="inc/conn.asp"-->
<!--#include file="inc/sqlin.asp"-->
<%
if request.QueryString("action")="add" then
MesTitle=Checkxss(trim(request.Form("MesTitle")))
LinkName=Checkxss(trim(request.Form("LinkName")))
Content=Checkxss(trim(request.Form("Content")))
yzm=Checkxss(trim(request.Form("yzm")))
if Session("GetCode")<>yzm then
	response.Write("<script>alert(""验证码错误。"");history.go(-1);</script>")
else
    sql="insert into Idea_GuestBook(MesTitle,LinkName,Content) values('"&MesTitle&"','"&LinkName&"','"&Content&"')"
	Call idea.exec("",-1)
	set rs = server.createobject("adodb.recordset")
	conn.execute(sql)
	set rs=nothing
	if idea_20=0 then
	response.write "<script language=javascript>alert('数据添加成功!');location.href='GuestBook.asp';</script>"
	else
	response.write "<script language=javascript>alert('数据添加成功,后台审核后显示!');location.href='GuestBook.asp';</script>"
	end if
end if
end if
Keyword=Trim(request.QueryString("Key"))
if idea_20=1 then
		Sql="Select * from Idea_GuestBook where IsShow="&GetState()&""
	else
		Sql="Select * from Idea_GuestBook"
end if
if Keyword<>"" then
		Sql=Sql&" and Content like '%"&Keyword&"%'"
	end if
Sql=Sql&" order by ID desc"

Page = Trim(Request.QueryString("Page"))
if Page = "" or Page < "1" then
	Page = "1"
end if
set rspage=idea.exec(Sql,1)
if session("PageSize")="" or isnull(session("PageSize")) then
    session("PageSize")="5"
end if	 
rspage.pagesize=cint(session("PageSize"))
Page = CInt(Page)
if rspage.pagecount > "0" then
    rspage.absolutepage = Page
end If

if request.QueryString("Str")="" then
	Title="留言反馈"
	IndexTemplateHtml=Replace(FSOFileRead("template/"&idea_3&"/html/guestbook.html"),"{template_head}",FSOFileRead("template/"&idea_3&"/html/head.html"))
	IndexTemplateHtml=Replace(IndexTemplateHtml,"{template_foot}",FSOFileRead("template/"&idea_3&"/html/foot.html"))
	IndexTemplateHtml=replace(IndexTemplateHtml,"images/","template/"&idea_3&"/images/")
	AllTemplateHtml=ReplaceGlobalLable(GetAllHtml_List(IndexTemplateHtml,Const_Rule,"",Keyword,Page))
	PageNumber_1=viewPage(rspage.recordcount,Page,4,session("PageLength"),rspage.pagecount)
	GetAllHtml2=replace(AllTemplateHtml,"{idea_pagenumber}",PageNumber_1)
elseif request.QueryString("Str")="签写留言" then
	Title="签写留言"
	IndexTemplateHtml=Replace(FSOFileRead("template/"&idea_3&"/html/guestbook.html"),"{template_head}",FSOFileRead("template/"&idea_3&"/html/head.html"))
	IndexTemplateHtml=Replace(IndexTemplateHtml,"{template_foot}",FSOFileRead("template/"&idea_3&"/html/foot.html"))
	IndexTemplateHtml=replace(IndexTemplateHtml,"images/","template/"&idea_3&"/images/")
	AllTemplateHtml=ReplaceGlobalLable(GetAllHtml_List(IndexTemplateHtml,Const_Rule,"签写留言",Keyword,Page))
	GetAllHtml2=replace(AllTemplateHtml,"{idea_pagenumber}","")
else
	Response.Write "<script>alert('参数错误!');history.go(-1);</script>"
	Response.End()
end if

GetAllHtml2=replace(GetAllHtml2,"{idea_title}",Title)
response.write GetAllHtml2
rspage.close
set rspage=nothing

'-----------------------------显示分页-----------------------------------
Function viewPage(AllRecordsCount,CurrentPage,BeforePages,ViewPageCount,AllPageNumber)
	Str_PageList1=MakePageNumber1(CurrentPage,BeforePages,ViewPageCount,AllPageNumber,"asp")
	if CurrentPage=1 then
		FirstPagelink="首页"
		LastPagelink="上一页"
	else
		FirstPagelink="<a href=GuestBook.asp>首页</a>"
		if CurrentPage=2 then
			LastPagelink="<a href=GuestBook.asp>上一页</a>"
		else
			LastPagelink="<a href=?Page="&CurrentPage-1&">上一页</a>"
		end if
	end if
	if CurrentPage=AllPageNumber then
		NextPagelink="下一页"
		FinalPagelink="尾页"
	else
		NextPagelink="<a href=?Page="&CurrentPage+1&">下一页</a>"
		FinalPagelink="<a href=?Page="&AllPageNumber&">尾页</a>"
	end if
	Str_PageList2="<div class='page'>页次:"&CurrentPage&"/"&AllPageNumber&"页&nbsp;&nbsp;"&FirstPagelink&"&nbsp;&nbsp;"&LastPagelink&"&nbsp;&nbsp;"&Str_PageList1&"&nbsp;&nbsp;"&NextPagelink&"&nbsp;&nbsp;"&FinalPagelink&"&nbsp;&nbsp;共"&AllRecordsCount&"条记录&nbsp;&nbsp;</div>"
	viewPage=Str_PageList2
End Function
%>